package day07;
//录入评分取平均分
 import java.util.Scanner;

public class CalTotalAvg {
    public static void main(String[] args) {
        double[] scors= enterData();//录入成绩
       // double total = calTotal(scors);//计算总分
       // System.out.println("总分为："+total);
        double avg =calAvg(scors);//计算平均分
        System.out.println("平均分为："+avg);
    }
    public static double[] enterData(){
        Scanner scan =new Scanner(System.in);
        double[] scors=new double[6];
        for (int i=0;i<scors.length;i++){
            System.out.println("请录入第"+(i+1)+"个评委的分数");
            scors[i]= scan.nextDouble();
        }


        return scors;
    }
    public static double calTotal(double[] scors){
         double total=0.0;
         double max=scors[0];
         double min =scors[0];
         for (int i=0;i<scors.length;i++){
             if (scors[i]>max){
                 max=scors[i];
             }
             if (scors[i]<min){
                 min=scors[i];
             }
             total+=scors[i];
         }

         return total-max-min;
    }
    public static double calAvg(double[] scors){
        double total =calTotal(scors);
        double avg = total/(scors.length-2);
        return avg;
    }

    }











